\(\int x (d+e x) (a+b \log (c x^n))^2 \, dx\) [77]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 109 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{4} b^2 d n^2 x^2+\frac {2}{27} b^2 e n^2 x^3-\frac {1}{2} b d n x^2 \left (a+b \log \left (c x^n\right )\right )-\frac {2}{9} b e n x^3 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} d x^2 \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{3} e x^3 \left (a+b \log \left (c x^n\right )\right )^2 \]

[Out]

1/4*b^2*d*n^2*x^2+2/27*b^2*e*n^2*x^3-1/2*b*d*n*x^2*(a+b*ln(c*x^n))-2/9*b*e*n*x^3*(a+b*ln(c*x^n))+1/2*d*x^2*(a+
b*ln(c*x^n))^2+1/3*e*x^3*(a+b*ln(c*x^n))^2

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {2395, 2342, 2341} \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} d x^2 \left (a+b \log \left (c x^n\right )\right )^2-\frac {1}{2} b d n x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{3} e x^3 \left (a+b \log \left (c x^n\right )\right )^2-\frac {2}{9} b e n x^3 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{4} b^2 d n^2 x^2+\frac {2}{27} b^2 e n^2 x^3 \]

[In]

Int[x*(d + e*x)*(a + b*Log[c*x^n])^2,x]

[Out]

(b^2*d*n^2*x^2)/4 + (2*b^2*e*n^2*x^3)/27 - (b*d*n*x^2*(a + b*Log[c*x^n]))/2 - (2*b*e*n*x^3*(a + b*Log[c*x^n]))
/9 + (d*x^2*(a + b*Log[c*x^n])^2)/2 + (e*x^3*(a + b*Log[c*x^n])^2)/3

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2395

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol]
:> With[{u = ExpandIntegrand[(a + b*Log[c*x^n])^p, (f*x)^m*(d + e*x^r)^q, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[
{a, b, c, d, e, f, m, n, p, q, r}, x] && IntegerQ[q] && (GtQ[q, 0] || (IGtQ[p, 0] && IntegerQ[m] && IntegerQ[r
]))

Rubi steps \begin{align*} \text {integral}& = \int \left (d x \left (a+b \log \left (c x^n\right )\right )^2+e x^2 \left (a+b \log \left (c x^n\right )\right )^2\right ) \, dx \\ & = d \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx+e \int x^2 \left (a+b \log \left (c x^n\right )\right )^2 \, dx \\ & = \frac {1}{2} d x^2 \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{3} e x^3 \left (a+b \log \left (c x^n\right )\right )^2-(b d n) \int x \left (a+b \log \left (c x^n\right )\right ) \, dx-\frac {1}{3} (2 b e n) \int x^2 \left (a+b \log \left (c x^n\right )\right ) \, dx \\ & = \frac {1}{4} b^2 d n^2 x^2+\frac {2}{27} b^2 e n^2 x^3-\frac {1}{2} b d n x^2 \left (a+b \log \left (c x^n\right )\right )-\frac {2}{9} b e n x^3 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} d x^2 \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{3} e x^3 \left (a+b \log \left (c x^n\right )\right )^2 \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.75 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{108} x^2 \left (8 b e n x \left (-3 a+b n-3 b \log \left (c x^n\right )\right )+27 b d n \left (-2 a+b n-2 b \log \left (c x^n\right )\right )+54 d \left (a+b \log \left (c x^n\right )\right )^2+36 e x \left (a+b \log \left (c x^n\right )\right )^2\right ) \]

[In]

Integrate[x*(d + e*x)*(a + b*Log[c*x^n])^2,x]

[Out]

(x^2*(8*b*e*n*x*(-3*a + b*n - 3*b*Log[c*x^n]) + 27*b*d*n*(-2*a + b*n - 2*b*Log[c*x^n]) + 54*d*(a + b*Log[c*x^n
])^2 + 36*e*x*(a + b*Log[c*x^n])^2))/108

Maple [A] (verified)

Time = 0.13 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.42

method result size
parallelrisch \(\frac {x^{3} b^{2} \ln \left (c \,x^{n}\right )^{2} e}{3}-\frac {2 \ln \left (c \,x^{n}\right ) x^{3} b^{2} n e}{9}+\frac {2 b^{2} e \,n^{2} x^{3}}{27}+\frac {2 x^{3} a b \ln \left (c \,x^{n}\right ) e}{3}-\frac {2 b n \,x^{3} a e}{9}+\frac {x^{2} b^{2} \ln \left (c \,x^{n}\right )^{2} d}{2}-\frac {\ln \left (c \,x^{n}\right ) x^{2} b^{2} n d}{2}+\frac {b^{2} d \,n^{2} x^{2}}{4}+\frac {x^{3} a^{2} e}{3}+x^{2} a b \ln \left (c \,x^{n}\right ) d -\frac {b n a d \,x^{2}}{2}+\frac {x^{2} a^{2} d}{2}\) \(155\)
risch \(\text {Expression too large to display}\) \(1621\)

[In]

int(x*(e*x+d)*(a+b*ln(c*x^n))^2,x,method=_RETURNVERBOSE)

[Out]

1/3*x^3*b^2*ln(c*x^n)^2*e-2/9*ln(c*x^n)*x^3*b^2*n*e+2/27*b^2*e*n^2*x^3+2/3*x^3*a*b*ln(c*x^n)*e-2/9*b*n*x^3*a*e
+1/2*x^2*b^2*ln(c*x^n)^2*d-1/2*ln(c*x^n)*x^2*b^2*n*d+1/4*b^2*d*n^2*x^2+1/3*x^3*a^2*e+x^2*a*b*ln(c*x^n)*d-1/2*b
*n*a*d*x^2+1/2*x^2*a^2*d

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 219 vs. \(2 (97) = 194\).

Time = 0.27 (sec) , antiderivative size = 219, normalized size of antiderivative = 2.01 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{27} \, {\left (2 \, b^{2} e n^{2} - 6 \, a b e n + 9 \, a^{2} e\right )} x^{3} + \frac {1}{4} \, {\left (b^{2} d n^{2} - 2 \, a b d n + 2 \, a^{2} d\right )} x^{2} + \frac {1}{6} \, {\left (2 \, b^{2} e x^{3} + 3 \, b^{2} d x^{2}\right )} \log \left (c\right )^{2} + \frac {1}{6} \, {\left (2 \, b^{2} e n^{2} x^{3} + 3 \, b^{2} d n^{2} x^{2}\right )} \log \left (x\right )^{2} - \frac {1}{18} \, {\left (4 \, {\left (b^{2} e n - 3 \, a b e\right )} x^{3} + 9 \, {\left (b^{2} d n - 2 \, a b d\right )} x^{2}\right )} \log \left (c\right ) - \frac {1}{18} \, {\left (4 \, {\left (b^{2} e n^{2} - 3 \, a b e n\right )} x^{3} + 9 \, {\left (b^{2} d n^{2} - 2 \, a b d n\right )} x^{2} - 6 \, {\left (2 \, b^{2} e n x^{3} + 3 \, b^{2} d n x^{2}\right )} \log \left (c\right )\right )} \log \left (x\right ) \]

[In]

integrate(x*(e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="fricas")

[Out]

1/27*(2*b^2*e*n^2 - 6*a*b*e*n + 9*a^2*e)*x^3 + 1/4*(b^2*d*n^2 - 2*a*b*d*n + 2*a^2*d)*x^2 + 1/6*(2*b^2*e*x^3 +
3*b^2*d*x^2)*log(c)^2 + 1/6*(2*b^2*e*n^2*x^3 + 3*b^2*d*n^2*x^2)*log(x)^2 - 1/18*(4*(b^2*e*n - 3*a*b*e)*x^3 + 9
*(b^2*d*n - 2*a*b*d)*x^2)*log(c) - 1/18*(4*(b^2*e*n^2 - 3*a*b*e*n)*x^3 + 9*(b^2*d*n^2 - 2*a*b*d*n)*x^2 - 6*(2*
b^2*e*n*x^3 + 3*b^2*d*n*x^2)*log(c))*log(x)

Sympy [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.69 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {a^{2} d x^{2}}{2} + \frac {a^{2} e x^{3}}{3} - \frac {a b d n x^{2}}{2} + a b d x^{2} \log {\left (c x^{n} \right )} - \frac {2 a b e n x^{3}}{9} + \frac {2 a b e x^{3} \log {\left (c x^{n} \right )}}{3} + \frac {b^{2} d n^{2} x^{2}}{4} - \frac {b^{2} d n x^{2} \log {\left (c x^{n} \right )}}{2} + \frac {b^{2} d x^{2} \log {\left (c x^{n} \right )}^{2}}{2} + \frac {2 b^{2} e n^{2} x^{3}}{27} - \frac {2 b^{2} e n x^{3} \log {\left (c x^{n} \right )}}{9} + \frac {b^{2} e x^{3} \log {\left (c x^{n} \right )}^{2}}{3} \]

[In]

integrate(x*(e*x+d)*(a+b*ln(c*x**n))**2,x)

[Out]

a**2*d*x**2/2 + a**2*e*x**3/3 - a*b*d*n*x**2/2 + a*b*d*x**2*log(c*x**n) - 2*a*b*e*n*x**3/9 + 2*a*b*e*x**3*log(
c*x**n)/3 + b**2*d*n**2*x**2/4 - b**2*d*n*x**2*log(c*x**n)/2 + b**2*d*x**2*log(c*x**n)**2/2 + 2*b**2*e*n**2*x*
*3/27 - 2*b**2*e*n*x**3*log(c*x**n)/9 + b**2*e*x**3*log(c*x**n)**2/3

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.38 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{3} \, b^{2} e x^{3} \log \left (c x^{n}\right )^{2} - \frac {2}{9} \, a b e n x^{3} + \frac {2}{3} \, a b e x^{3} \log \left (c x^{n}\right ) + \frac {1}{2} \, b^{2} d x^{2} \log \left (c x^{n}\right )^{2} - \frac {1}{2} \, a b d n x^{2} + \frac {1}{3} \, a^{2} e x^{3} + a b d x^{2} \log \left (c x^{n}\right ) + \frac {1}{2} \, a^{2} d x^{2} + \frac {1}{4} \, {\left (n^{2} x^{2} - 2 \, n x^{2} \log \left (c x^{n}\right )\right )} b^{2} d + \frac {2}{27} \, {\left (n^{2} x^{3} - 3 \, n x^{3} \log \left (c x^{n}\right )\right )} b^{2} e \]

[In]

integrate(x*(e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

1/3*b^2*e*x^3*log(c*x^n)^2 - 2/9*a*b*e*n*x^3 + 2/3*a*b*e*x^3*log(c*x^n) + 1/2*b^2*d*x^2*log(c*x^n)^2 - 1/2*a*b
*d*n*x^2 + 1/3*a^2*e*x^3 + a*b*d*x^2*log(c*x^n) + 1/2*a^2*d*x^2 + 1/4*(n^2*x^2 - 2*n*x^2*log(c*x^n))*b^2*d + 2
/27*(n^2*x^3 - 3*n*x^3*log(c*x^n))*b^2*e

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 238 vs. \(2 (97) = 194\).

Time = 0.33 (sec) , antiderivative size = 238, normalized size of antiderivative = 2.18 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{3} \, b^{2} e n^{2} x^{3} \log \left (x\right )^{2} - \frac {2}{9} \, b^{2} e n^{2} x^{3} \log \left (x\right ) + \frac {2}{3} \, b^{2} e n x^{3} \log \left (c\right ) \log \left (x\right ) + \frac {1}{2} \, b^{2} d n^{2} x^{2} \log \left (x\right )^{2} + \frac {2}{27} \, b^{2} e n^{2} x^{3} - \frac {2}{9} \, b^{2} e n x^{3} \log \left (c\right ) + \frac {1}{3} \, b^{2} e x^{3} \log \left (c\right )^{2} - \frac {1}{2} \, b^{2} d n^{2} x^{2} \log \left (x\right ) + \frac {2}{3} \, a b e n x^{3} \log \left (x\right ) + b^{2} d n x^{2} \log \left (c\right ) \log \left (x\right ) + \frac {1}{4} \, b^{2} d n^{2} x^{2} - \frac {2}{9} \, a b e n x^{3} - \frac {1}{2} \, b^{2} d n x^{2} \log \left (c\right ) + \frac {2}{3} \, a b e x^{3} \log \left (c\right ) + \frac {1}{2} \, b^{2} d x^{2} \log \left (c\right )^{2} + a b d n x^{2} \log \left (x\right ) - \frac {1}{2} \, a b d n x^{2} + \frac {1}{3} \, a^{2} e x^{3} + a b d x^{2} \log \left (c\right ) + \frac {1}{2} \, a^{2} d x^{2} \]

[In]

integrate(x*(e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

1/3*b^2*e*n^2*x^3*log(x)^2 - 2/9*b^2*e*n^2*x^3*log(x) + 2/3*b^2*e*n*x^3*log(c)*log(x) + 1/2*b^2*d*n^2*x^2*log(
x)^2 + 2/27*b^2*e*n^2*x^3 - 2/9*b^2*e*n*x^3*log(c) + 1/3*b^2*e*x^3*log(c)^2 - 1/2*b^2*d*n^2*x^2*log(x) + 2/3*a
*b*e*n*x^3*log(x) + b^2*d*n*x^2*log(c)*log(x) + 1/4*b^2*d*n^2*x^2 - 2/9*a*b*e*n*x^3 - 1/2*b^2*d*n*x^2*log(c) +
 2/3*a*b*e*x^3*log(c) + 1/2*b^2*d*x^2*log(c)^2 + a*b*d*n*x^2*log(x) - 1/2*a*b*d*n*x^2 + 1/3*a^2*e*x^3 + a*b*d*
x^2*log(c) + 1/2*a^2*d*x^2

Mupad [B] (verification not implemented)

Time = 0.42 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.06 \[ \int x (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx={\ln \left (c\,x^n\right )}^2\,\left (\frac {e\,b^2\,x^3}{3}+\frac {d\,b^2\,x^2}{2}\right )+\ln \left (c\,x^n\right )\,\left (\frac {2\,b\,e\,\left (3\,a-b\,n\right )\,x^3}{9}+\frac {b\,d\,\left (2\,a-b\,n\right )\,x^2}{2}\right )+\frac {d\,x^2\,\left (2\,a^2-2\,a\,b\,n+b^2\,n^2\right )}{4}+\frac {e\,x^3\,\left (9\,a^2-6\,a\,b\,n+2\,b^2\,n^2\right )}{27} \]

[In]

int(x*(a + b*log(c*x^n))^2*(d + e*x),x)

[Out]

log(c*x^n)^2*((b^2*d*x^2)/2 + (b^2*e*x^3)/3) + log(c*x^n)*((b*d*x^2*(2*a - b*n))/2 + (2*b*e*x^3*(3*a - b*n))/9
) + (d*x^2*(2*a^2 + b^2*n^2 - 2*a*b*n))/4 + (e*x^3*(9*a^2 + 2*b^2*n^2 - 6*a*b*n))/27